import {
  ISearchCond,
  IControlState,
  IFilterNodeField,
  IFilterNodeGroup,
} from '@ibiz-template/runtime';

export interface IFilterItem {
  /**
   * @description 过滤项标识
   * @type {string}
   * @memberof IFilterItem
   */
  key: string;

  /**
   * @description 标题
   * @type {string}
   * @memberof IFilterItem
   */
  caption: string;

  /**
   * @description 选中状态
   * @type {boolean}
   * @memberof IFilterItem
   */
  selected: boolean;
}

export interface IFilterItemGroup {
  /**
   * @description 标题
   * @type {string}
   * @memberof IFilterItemGroup
   */
  caption: string;

  /**
   * @description 过滤项
   * @type {IFilterItem[]}
   * @memberof IFilterItemGroup
   */
  children: IFilterItem[];
}

export interface IFilter {
  /**
   * @description 唯一标识
   * @type {string}
   * @memberof IFilter
   */
  key: string;
  /**
   * @description 标题
   * @type {string}
   * @memberof IFilter
   */
  caption: string;
  /**
   * @description 过滤项
   * @type {IFilterNodeField[]}
   * @memberof IFilter
   */
  filterNodeFields: IFilterNodeField[];
}

export interface IFilterGroup {
  /**
   * @description 唯一标识
   * @type {string}
   * @memberof IFilterGroup
   */
  key: string;
  /**
   * @description 标题
   * @type {string}
   * @memberof IFilterGroup
   */
  caption: string;
  /**
   * @description 显示
   * @type {boolean}
   * @memberof IFilterGroup
   */
  visible: boolean;
  /**
   * @description 默认选中
   * @type {boolean}
   * @memberof IFilterGroup
   */
  defaultSelect: boolean;
  /**
   * @description 计数
   * @type {number}
   * @memberof IFilterGroup
   */
  count?: number;
  /**
   * @description 计数器标识
   * @type {string}
   * @memberof IFilterGroup
   */
  counterId?: string;
  /**
   * @description 计数器模式
   * @type {number}
   * @memberof IFilterGroup
   */
  counterMode?: number;
  /**
   * @description 分组条件
   * @type {ISearchCond[]}
   * @memberof IFilterGroup
   */
  searchconds: ISearchCond[];
}

export interface IEhrSearchBarState extends IControlState {
  /**
   * @description 过滤项节点集合
   * @type {IFilterNodeGroup[]}
   * @memberof IEhrSearchBarState
   */
  filterNodes: IFilterNodeGroup[];

  /**
   * @description 过滤项分组
   * @type {IFilterItemGroup[]}
   * @memberof IEhrSearchBarState
   */
  filterItemGroups: IFilterItemGroup[];

  /**
   * @description 保存的过滤条件
   * @type {IFilter[]}
   * @memberof IEhrSearchBarState
   */
  filters: IFilter[];

  /**
   * @description 激活过滤项
   * @type {string}
   * @memberof IEhrSearchBarState
   */
  activeFilter: string;

  /**
   * @description 激活过滤分组
   * @type {string}
   * @memberof IEhrSearchBarState
   */
  activeGroup: string;

  /**
   * @description 过滤分组
   * @type {IFilterGroup[]}
   * @memberof IEhrSearchBarState
   */
  filterGroups: IFilterGroup[];
}
